{% extends "simgenex/base_simgenex.html" %}
{% load ts_extras %}
{%block center%}
{% include "simgenex/addInstructionModal.html" %}

<div class="edit_form" >
    <h2 class="title">Measurement Matrix Settings</h2>
    <form action="add" method="post" class="edit">
        {% csrf_token %}
        <fieldset class="border">
            <legend><label>Measurement Process</label></legend>
            <span class="helptext"> Specifying how individual gene expression values are normalized</span>
            <div id="transformation" class="input_field" >
                <label>Transformation Method</label>
                <span class="helptext">Select the transformation expression applied to raw expression level matrix</span>
                <select name="transformation" >
                    <option title="The expression level values from raw simulation matrix are transform linearly to measurement matrix" value="linear"> linear </option>
                    <option title="The expression level are transformed from raw simulation matrix to measurement matrix using log operation"value="log">log</option>
                    <option title="The expression level are transformed from raw simulation matrix to measurement matrix by using log-ratio between current column and a reference column"value="log-ratio">log-ratio</option>
                </select>
            </div>
            <div id="offset" class="input_field" >
                <label>Offset</label>
                <span class="helptext">Set the offset for the transformation expression</span>
                <input type="text" name="offset" />
            </div>
            <div id="reference_column" class="input_field">
                <label for="reference_column">Reference Column</label>
                <span class="helptext">Choose the reference column to apply log-ratio transformation</span>
                <select name="reference">
                    {% for simex in request.session.sgx_program.sgx.simexpression_defs %}
                    {% for col in simex.get_simulated_column_header_list %}
                    <option value="{{col}}">{{col}}</option>
                    {% endfor %}
                    {% endfor %}
                </select>
            </div>

        </fieldset>
        <fieldset class="border">
            <legend><label>Measurement Columns</label></legend>
            <span class="helptext">Specifying the columns in the simulated matrix. (It is generated by default, if you wish to view it, click "View" button below.)</span>
            <div class="input_field">
            <a id="measurement_columns" href="{%url tsworkbench.views.sgx.viewSgx request.session.sgx_program.name|escapeUrl%}"  class="link-button">View</a>
            </div>
            <div id="generated_measurement_columns" class="input_field"></div>
        </fieldset>
        <fieldset class="border">
            <legend><label>Gene Mapping</label></legend>
            <span class="helptext">Specifying names of genes in the computational model that can be mapped to names in the target matrix.</span>
            <div class="input_field">
                <label>Transsys Program</label>
                <span class="helptext">Select the transsys program that you want to generate gene mapping from.</span>
                <select name="tp" >
                    {% for target_tp in request.session.sgx_program.target_tp %}
                    <option value="{{target_tp.name}}">{{target_tp.name}}</option>
                    {% endfor %}
                </select>
            </div>
            <div class="input_field">
            <a id="gene_mapping" href="{%url tsworkbench.views.sgx.viewSgx request.session.sgx_program.name|escapeUrl%}" class="link-button">Generate</a>
            </div>
            <div id="generated_gene_mapping" class="input_field"></div>
        </fieldset>
        <div>
            <button type="submit" name="submit" > Submit</button>
        </div>
    </form>
</div>
{% endblock %}